perm filename SECT.POX[POX,WD]1 blob sn#363248 filedate 1978-06-18 generic text, type T, neo UTF8
\|\\;				Define Brick Character
\;
\⊂'000040;\;	VERREM - REM's syntax for defining macros with args 
\;
\;			       Global Q-registers
\;
\	;\←'0;\→F\;	formula numbers
\	;\←'0;\→J\;	figure numbers
\	;\←'0;\→S\;	section numbers
\	;\←'0;\→T\;	subsection numbers
\	;\←'0;\→U\;	page number within a section
\∞PAGNUM[1]\;		page numbers
\;
\;
\;				 Dynamic Flags
\;
\∞INSECFLAG[\←=0;]\;	inside a section ?
\;
\;	       Formula and Figure Definition and Reference Macros
\;
\∞HYPHEN[-]\;
\;
\∞PERIOD[.]\;
\;
\∞SPACE[ \-=1;]\;		print space and decrement ac
\;
\;
\;				    Formulas
\;
\8FORM(NAME)[\P\N					save ac
\	;\←F\+=1;\→F\N					increment form num
\	;\R(\DF)\N					print form num on right
\	;\!EVAL((\∞)⊗NAME⊗(FORMSECNUM[)\DS(]));\N	record secnum
\	;\!EVAL((\∞)⊗NAME⊗(FORMNUM[)\DF(]));\N	record formnum
\p]\;							restore ac
\;
\8REFFORM(NAME)[\P\N					save ac
\	;(\N						print "("
\	;\←S\N						load cur sect num
\	;\!EVAL((\-=)\!FORMSECNUM(⊗NAME⊗);(;));\N	if ≠ form's sec num
\	;\?FORMSECNUM(⊗NAME⊗);\?PERIOD;\N		then print form's secnum
\	;\!FORMNUM(⊗NAME⊗);\N				print formnum
\	;)\N						print ")"
\p]\;							restore ac
\;
\8FORREFFORM(NAME,SECNUM,FORMNUM)[\P\N			save ac
\	;(\N						print "("
\	;\←S\N						load cur sect num
\	;\!EVAL((\-=)⊗SECNUM⊗(;));\N			if ≠ form's sec num
\	;\?EVAL(⊗SECNUM⊗);\?PERIOD;\N			then print form's secnum
\	;⊗FORMNUM⊗\N					print formnum
\	;)\N						print ")"
\p]\;							restore ac
\;
\8FORMSECNUM(NAME)[\!⊗NAME⊗FORMSECNUM;]\;
\;
\8FORMNUM(NAME)[\!⊗NAME⊗FORMNUM;]\;
\;
\;
\;				    Figures
\;
\8FIG(NAME,CAPT)[\P\N					save ac
\	;\←J\+=1;\→J\N					increment fig num
\	;\C Figure \DJ. ⊗CAPT⊗.\N			print caption with fig num
\	;\!EVAL((\∞)⊗NAME⊗(FIGSECNUM[)\DS(]));\N	record fig's sect num
\	;\!EVAL((\∞)⊗NAME⊗(FIGNUM[)\DJ(]));\N		record fig num
\p]\;							restore ac
\;
\8EXTFIG(NAME,HEIGHT,CAPT)[\N		space and caption for external figure
\	;\P\N						save ac
\	;\!FIGSPACE(⊗HEIGHT⊗);\N			leave room for fig
\	;\←J\+=1;\→J\N					increment fig num
\	;\C Figure \DJ. ⊗CAPT⊗.\N			print caption with fig num
\	;\!EVAL((\∞)⊗NAME⊗(FIGSECNUM[)\DS(]));\N	record fig's sect num
\	;\!EVAL((\∞)⊗NAME⊗(FIGNUM[)\DJ(]));\N		record fig num
\p]\;							restore ac
\;
\8FIGSPACE(PIXELS)[\N		figure space macro
\	;\P\Q,\N			save ac and comma
\	;\←=⊗PIXELS⊗;\N			load # of pixels to skip
\	;\+,\N				add comma
\	;\→,\N				store result in comma
\	;\A=32;\N			print a space
\q,\p\;]\;				restore comma and ac
\;
\8REFFIG(NAME)[\P\N					save ac
\	;Fig. \N					print "Fig. "
\	;\←S\N						load cur sect num
\	;\!EVAL((\-=)\!FIGSECNUM(⊗NAME⊗);(;));\N	if ≠ fig's secnum
\	;\?FIGSECNUM(⊗NAME⊗);\?PERIOD;\N		print fig's secnum
\	;\!FIGNUM(⊗NAME⊗);\N				print fignum
\p]\;							restore ac
\;
\8FORREFFIG(NAME,SECNUM,FIGNUM)[\P\N			save ac
\	;Fig. \N					print "Fig. "
\	;\←S\N						load cur sect num
\	;\!EVAL((\-=)⊗SECNUM⊗(;));\N			if ≠ fig's secnum
\	;\?EVAL(⊗SECNUM⊗);\?PERIOD;\N			print fig's secnum
\	;⊗FIGNUM⊗\N					print fignum
\p]\;							restore ac
\;
\8FIGSECNUM(NAME)[\!⊗NAME⊗FIGSECNUM;]\;
\;
\8FIGNUM(NAME)[\!⊗NAME⊗FIGNUM;]\;
\;
\;                           Section Macros
\;
\;
\8SECT(NAME,TIT)[\N		section macro
\	;\P\Q0\N			save ac and reg 0
\	;\∂←INSECFLAG;\N		expunge old INSECFLAG
\	;\∞INSECFLAG[\←=1;]\N		turn on INSECFLAG
\	;\←S\+=1;\→S\N			increment section number
\	;\←'0;\→U\N			set local page # to 0
\	;\←'0;\→F\N			set formula # to 0
\	;\←'0;\→J\N			set illustration # to 0
\	;\←'0;\→T\N			set subsec # to 0
\	;\F1\N				reset font to #1
\	;\!LOADAC(PAGNUM);\N		load ac with pagnum
\	;\!ISACODD;\N
\	;\?INCR(PAGNUM);\N
\	;\!EVAL((\∞)⊗NAME⊗(SECNUM[)\DS(]));\N
\	;\N				store section #
\	;\!EVAL((\m{
)\!ROMAN(\DS);( - )\!CAPALL(⊗TIT⊗);(	)\!LOADAC(PAGNUM);\+=1;\D∀(
)(}));\N						type sect title
\	;\!EVAL((\==1;{)\A=13;\A=10;(}));\N
\	;\!EVAL((\==1;{)\!ROMAN(\DS);(.)(}));\N
\	;\!LENGTH(\!ROMAN(\DS););\N	length of secnum to ac
\	;\¬=8;\N			sub from indentation
\	;\-=1;\N			sub1 for "."
\	;\!EVAL((\==1;{)\ISPACE;\!CAPALL(⊗TIT⊗);(}));\N
\	;\←R\N				put right marg in ac
\	;\-L\N				subtract left marg
\	;\#\F0\/w \G\N			div by fnt wdth to get linel
\	;\→0\N				store ac in reg 0
\	;\!LENGTH(⊗TIT⊗);\N		length of title to ac
\	;\¬0\N				sub from linelength
\	;\-=8;\N			sub length of tab
\	;\→0\N				store ac in reg 0
\	;\!LENGTH(\!PAGNUM;);\N		length of pagenum to ac
\	;\¬0\N				sub from linelength
\	;\!EVAL((\==1;{)\ISPACE;\!LOADAC(PAGNUM);\+=1;\D∀(}));\N
\	;\!EVAL((\==1;{)\A=13;\A=10;(}));\N
\	;\C\#\F5Section \!ROMAN(\DS); - ⊗TIT⊗\G\;	print section header
\	;\p]\;						restore ac
\;
\;
\;			 Odd (unnumbered) Section Macro
\;
\8ODDSEC(NAME,TIT)[\P\N					save ac
\	;\←'0;\→U\N					set local page # to 0
\	;\←'0;\→F\N					set form # to 0
\	;\←'0;\→J\N					set illustration # to 0
\	;\←'0;\→T\N					set subsec # to 0
\	;\F1\N						reset font to #1
\	;\!LOADAC(PAGNUM);\N		load ac with pagnum
\	;\!ISACODD;\N
\	;\?INCR(PAGNUM);\N
\	;\!EVAL((\∞)⊗NAME⊗(SECNUM[)\DS(]));\N		store section #
\	;\!EVAL((\m{
)\!CAPALL(⊗TIT⊗);(	)\!LOADAC(PAGNUM);\+=1;\D∀(
)(}));\N						type sect title
\	;\!EVAL((\==1;{)\A=13;\A=10;(}));\N
\	;\!EVAL((\==1;{)\!CAPALL(⊗TIT⊗);(}));\N
\	;\←R\N				put right marg in ac
\	;\-L\N				subtract left marg
\	;\#\F0\/w \G\N			div by fnt wdth to get linel
\	;\→0\N				store ac in reg 0
\	;\!LENGTH(⊗TIT⊗);\N		length of title to ac
\	;\¬0\N				sub from linelength
\	;\→0\N				store ac in reg 0
\	;\!LENGTH(\!PAGNUM;);\N		length of pagenum to ac
\	;\¬0\N				sub from linelength
\	;\!EVAL((\==1;{)\ISPACE;\!LOADAC(PAGNUM);\+=1;\D∀(}));\N
\	;\!EVAL((\==1;{)\A=13;\A=10;(}));\N
\	;\C\#\F5⊗TIT⊗\G\N				print section header
\	;\p]\;						restore ac
\;
\;
\;			    Section Reference Macro
\;
\8REFSEC(NAME)[Section \N				print "Section "
\	;\!ROMAN(\!SECNUM(⊗NAME⊗););]\;			print sect num
\;
\;
\8FORREFSEC(NAME,NUMBER)[Section \N			print "Section "
\	;\!ROMAN(⊗NUMBER⊗);]\;				print sect num
\;
\;
\;			      End of Section Macro
\;
\∞ENDSEC[\∂←INSECFLAG;\∞INSECFLAG[\←=0;]]\;		turn off INSECFLAG
\;
\8SECNUM(NAME)[\!⊗NAME⊗SECNUM;]\;
\;
\;
\;			       Subsection Macros
\;
\8SUBSEC(NAME,TIT)[\P\N					save ac
\	;\←T\+=1;\→T\N					increment subsec #
\	;\!EVAL((\∞)⊗NAME⊗(SUBSECSECNUM[)\DS(]));\N	store section #
\	;\!EVAL((\∞)⊗NAME⊗(SUBSECNUM[)\DT(]));\N	store subsec #
\	;\!EVAL((\==1;{)\A=13;\A=10;(}));\N
\	;\←=16;\N			length of indent to ac
\	;\!EVAL((\==1;{)\ISPACE;\!CAPALL(⊗TIT⊗);(}));\N
\	;\←R\N				put right marg in ac
\	;\-L\N				subtract left marg
\	;\#\F0\/w \G\N			div by fnt wdth to get linel
\	;\→0\N				store ac in reg 0
\	;\!LENGTH(⊗TIT⊗);\N		length of title to ac
\	;\¬0\N				sub from linelength
\	;\-=16;\N			sub length of indent
\	;\→0\N				store ac in reg 0
\	;\!LENGTH(\!PAGNUM;);\N		length of pagenum to ac
\	;\¬0\N				sub from linelength
\	;\!EVAL((\==1;{)\ISPACE;\!PAGNUM;(}));\N
\	;\!EVAL((\==1;{)\A=13;\A=10;(}));\N
\	;\#\F2\!LETTER(\DT);. \!CAPFIRST(⊗TIT⊗);.\G\N	print subsec head

\	;\p]\;							restore ac
\;
\8REFSUBSEC(NAME)[\P\N					save ac
\	;Subsection \N					print "Subsection "
\	;\←S\N						get cur sec num
\	;\!EVAL((\-=)\!SUBSECSECNUM(⊗NAME⊗);(;));\N		if ≠ named sec num
\	;\?ROMAN(\!SUBSECSECNUM(⊗NAME⊗););\?HYPHEN;\N	then print sect num
\	;\!LETTER(\!SUBSECNUM(⊗NAME⊗););\N		print subsec num
\p]\;							restore ac
\;
\8FORREFSUBSEC(NAME,SECNUM,SUBSECNUM)[\P\N		save ac
\	;Subsection \N					print "Subsection "
\N\	;\←S\N						get cur sec num
\N\	;\!EVAL((\¬=)⊗SECNUM⊗(;));\N			if ≠ named sec num
\	;\←=⊗SECNUM⊗;\N					get named sec num
\	;\-S\N						if = cur sec num
\	;\?ROMAN(⊗SECNUM⊗);\?HYPHEN;\N			then print sect num
\	;\!LETTER(⊗SUBSECNUM⊗);\N			print subsec num
\p]\;							restore ac
\;
\8SUBSECNUM(NAME)[\!⊗NAME⊗SUBSECNUM;]\;
\;
\8SUBSECSECNUM(NAME)[\!⊗NAME⊗SUBSECSECNUM;]\;
\;
\∞UNWRITTENSUBSECSECNUM[0]\;
\∞UNWRITTENSUBSECNUM[0]\;
\;
\;
\;				Running Title Macro
\;
\8RUNTIT(TIT)[\P\N			save ac
\	;\!RUNTITFLAG;\N		load run tit flag into ac
\	;\?IFRUNTIT((⊗TIT⊗));\N		do ifruntit macro
\p]\;					restore ac
\;
\;\8IFRUNTIT(TIT)[\N
\;\	;\!EVAL((\==1;{
\;		)\!TITCAPS(⊗TIT⊗);(	)\!PAGNUM;(
\;)(}));\N				put running title in cont
\;\	;\#\F2\[=2;=2;\!TITCAPS(⊗TIT⊗);\]\G]\;	print running title
\;\8IFRUNTIT(TIT)[\#\F2\[=2;=2;⊗TIT⊗\]\G]\;	print running title
\8IFRUNTIT(TIT)[\!EVAL((\==1;{
		)⊗TIT⊗(
)(}));\N				put running title in cont
\#\F2⊗TIT⊗\G]\;				print running title
\;
\;
\;				  Summary Macro
\;
\8SUMMARY(STR)[\P\!SUMMARYFLAG;\?IFSUMMARY((⊗STR⊗));\p]\;
\8IFSUMMARY(STR)[\P\Qε\Qλ\←=0;\→ε\ε\←=5;\→λ\λ\QL\QR\←L\+=160;\→L\←R\-=120;\→R\#\F0\N
	.	.	.	.	.	.	.	.	.
\J ⊗STR⊗ \.
.	.	.	.	.	.	.	.	.
\G\qR\qL\qλ\←λ\λ\qε\←ε\ε\p\;]\;
\;
\;
\;				  Remark Macro
\;
\8REMARK(STR)[\P\!REMARKFLAG;\?IFREMARK((⊗STR⊗));\p\;]\;
\8IFREMARK(STR)[\P\Qε\Qλ\gε\→ε\←=0;\ε\gλ\→λ\←=5;\λ\QL\QR\←L\+=160;\→L\←R\-=120;\→R\#\F0\N
	*	*	*	*	*	*	*	*	*
\J ⊗STR⊗ \.
*	*	*	*	*	*	*	*	*
\G\qR\qL\←λ\λ\←ε\ε\qλ\qε\p\;]\;
\;
\;
\;				  Revnote Macro
\;
\8REVNOTE(STR)[\P\!REVNOTEFLAG;\?IFREVNOTE((⊗STR⊗));\p\;]\;
\8IFREVNOTE(STR)[\P\Qε\Qλ\gε\→ε\←=0;\ε\gλ\→λ\←=5;\λ\QL\QR\←L\+=160;\→L\←R\-=120;\→R\#\F0\N
	#	#	#	#	#	#	#	#	#
\J REVIEWER: ⊗STR⊗ \.
#	#	#	#	#	#	#	#	#
\G\qR\qL\←λ\λ\←ε\ε\qλ\qε\p]\;
\;
\;
\;				  Footnote Macro
\;
\8FOOTNOTE(STR)[\P\Qε\Qλ\gε\→ε\←=0;\ε\gλ\→λ\←=5;\λ\QL\QR\←L\+=160;\→L\←R\-=120;\→R\#\F0\N
	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
\J FOOTNOTE: ⊗STR⊗ \.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
\G\qR\qL\←λ\λ\←ε\ε\qλ\qε\p]\;
\;